package org.example.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("producer")
public class ProducerController 
{
	@Autowired
	RabbitTemplate rabbitTemplate;
	
	@GetMapping("sentMes")
	public void sentMes(@RequestParam String mes)
	{
		//队列名称
		String queueName = "xiri.queue";
		//发送消息
		rabbitTemplate.convertAndSend(queueName,mes);
	}
}
